package com.itheima.二维数组;

import java.util.Random;
import java.util.Scanner;

/*
     猜数字
 */
public class Work03 {
    public static void main(String[] args) {
        Random r = new Random();
        Scanner sc = new Scanner(System.in);
        int num = r.nextInt(100) + 1;
        int num1;
        while (true) {
            System.out.println("请输入你猜的数字:");
            num1 = sc.nextInt();
            if (num1 > num) {
                System.out.println("大了");
            } else if (num1 < num) {
                System.out.println("小了");
            } else {
                System.out.println("恭喜你猜中了!");
                break;
            }
        }
    }
}
